So I followed your tut (https://youtu.be/qZNL4Ku1UQg?list=PLQVvvaa0QuDc_owjTbIY4rbgXOFkUYOUB&t=1046, https://pythonprogramming.net/creating-first-flask-web-app/) And i'm now getting the default ubuntu page. I have seen other problems in the comments and I can ensure you everything is correct (I redid it about 3 times to make sure each time it did the same thing).
:/var/www/FlaskApp# apache2ctl -S
:/var/www/FlaskApp# apache2ctl -S AH00112: Warning: DocumentRoot [/var/www/html] does not exist AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 85.10.68.132. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:80 is a NameVirtualHost default server 85.10.68.132 (/etc/apache2/sites-enabled/000-default.conf:1) port 80 namevhost 85.10.68.132 (/etc/apache2/sites-enabled/000-default.conf:1) port 80 namevhost 85.10.68.132 (/etc/apache2/sites-enabled/FlaskApp.conf:1) ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2/error.log" Mutex default: dir="/var/lock/apache2" mechanism=fcntl Mutex watchdog-callback: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="www-data" id=33 Group: name="www-data" id=33 root@vm132:/var/www/FlaskApp# root@vm132:/var/www/FlaskApp#
You must be logged in to post. Please login or register an account.
When you're seeing the ubuntu page, but you believe you set up everything, usually it's in the config file that didn't get setup right. In your case, it's looking for [/var/www/html] to display a page, well yeah, there's nothing there, but there shouldn't be because we're using Flask.
Copy and paste into here the contents of nano /etc/apache2/sites-available/FlaskApp.conf
-Harrison 7 years ago
You must be logged in to post. Please login or register an account.
I'm getting the same problem. I followed the 7 video tutorial last week and it all worked fine. Then I rebuilt my linode so that I could start anew with the longer tutorial (for the sake of practice.) Now I'm seeing the Apache2 Ubuntu Default Page for my url and a 500 Internal Service Error for my IP address. FlaskApp.conf, wsgi, __init__.py were copy and paste (minus replacing the IP address, email, and secret_passkey). See them below.
/etc/Apache2/sites-available/FlaskApp.conf:
<VirtualHost *:80> ServerName ##.##.###.### ServerAdmin serveradmin@email.com WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi <Directory /var/www/FlaskApp/FlaskApp/> Order allow,deny Allow from all </Directory> Alias /static /var/www/FlaskApp/FlaskApp/static <Directory /var/www/FlaskApp/FlaskApp/static/> Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
(obviously, my IP address goes in place of the # signs)
from FlaskApp import app as application application.secret_key = 'kajshf9234asdf'
(no, that's not actually my secret key)
/var/www/FlaskApp/FlaskApp/__init__.py:
from flask import Flask
app = Flask(__name__)
@app.route('/') def homepage(): return "Hi there, how ya doin?"
if __name__ == "__main__": app.run()
cd /var/www/ shows FlaskApp and html cd /var/www/FlaskApp shows FlaskApp and flaskapp.wsgi cd /var/www/FlaskApp/FlaskApp shows __init__.py static templates venv
-queuefive 7 years ago
Last edited 7 years ago
You must be logged in to post. Please login or register an account.
Not sure what changes I made, but I was able to get it to work by following the instructions given here: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps
The only things I saw were: in __init__.py, it changed
@app.route('/')
to
@app.route("/")
and after all the files were setup, prior to the final server restart, I entered
sudo a2ensite FlaskApp
though it said the app was already enabled. Something worked tho...
-queuefive 7 years ago
You must be logged in to post. Please login or register an account.